from PIL import Image
import os

# 按顺序加载六个面的图片（根据实际文件名调整顺序）
sides = ['front', 'back', 'left', 'right', 'top', 'bottom']
images = [Image.open(f"{side}.png") for side in sides]

# 验证所有图片尺寸一致
if any(img.size != (16, 16) for img in images):
    raise ValueError("All images must be 16x16 pixels")

# 创建横向排列的纹理图 (96x16)
texture = Image.new('RGB', (16 * 6, 16))

# 拼接图片
for i, img in enumerate(images):
    texture.paste(img, (i*16, 0))

# 保存为TIFF格式
texture.save('grass_block.tif')
print("Texture created: grass_block.tif")